package com.xy.dyson.controller;

import com.xy.dyson.entity.Resources;
import com.xy.dyson.service.ResourcesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * @author XY
 * @version 1.0
 * @date 2021/1/28 18:12
 * @Description
 */
@Controller
@RequestMapping("/index")
public class IndexController {

    @Autowired
    ResourcesService resourcesService;

    @GetMapping("/index")
    public String index(Model model){
        Resources resources = new Resources();
        List<Resources> list= resourcesService.queryAll(resources);
        model.addAttribute("data",list);
        return "index";
    }
}
